//###############
// FILE : FileComparator.java
// WRITER : Yaron Dinur, yarondi, 200184992
// WRITER : Yuval Ran, yuvran21, 032513483
// EXERCISE : oop ex1 2011
// DESCRIPTION:
//Compares two files by their filename (without the path)
//###############

package orders;

import java.io.File;
import java.util.Comparator;

public class FileComparator extends AbsComparator {

	// Compares the filename of the file (without the path)
	public int compare(File file1, File file2) {
		int result = (int) Math.signum((file1.getName()).compareTo(file2.getName()));
		//If the result is equal - calls AbsComparator
		if (result == 0)
			return super.compare(file1,file2);
		return result;
	}
}
